// 敏感词管理页面样式
.sensitive-word-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  
  .actions {
    display: flex;
    gap: 8px;
  }
}

.keyword-card,
.check-card,
.results-card {
  .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    
    .card-title {
      font-weight: 600;
      color: #303133;
    }
  }
}

// 敏感词管理区域
.keyword-management {
  .category-section {
    margin-bottom: 15px;
  }

  .keyword-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 15px;
    
    .keyword-item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 8px 0;
      border-bottom: 1px solid #f0f0f0;
      
      &:last-child {
        border-bottom: none;
      }
      
      .keyword-text {
        flex: 1;
        font-size: 14px;
        color: #303133;
      }
      
      .keyword-actions {
        display: flex;
        gap: 5px;
        
        .delete-btn {
          color: #f56c6c;
        }
      }
    }
  }

  .batch-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
  }
}

// 系统状态区域
.status-info {
  .status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    
    &:last-child {
      border-bottom: none;
    }
    
    .status-label {
      font-size: 13px;
      color: #606266;
    }
  }
}

// 快速操作区域
.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  
  .el-button {
    margin: 0;
    width: 100%;
  }
}

// 检查配置区域
.check-configuration {
  .config-form {
    .advanced-options {
      margin-top: 15px;
    }
  }

  .progress-section {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    
    .progress-info {
      margin-top: 10px;
      
      p {
        text-align: center;
        margin: 5px 0;
        color: #606266;
        font-size: 14px;
      }
      
      .progress-stats {
        display: flex;
        justify-content: space-around;
        font-size: 12px;
        color: #909399;
        margin-top: 8px;
        
        span {
          padding: 4px 8px;
          background: white;
          border-radius: 4px;
        }
      }
    }
  }
}

// 检查结果区域
.check-results {
  .result-actions {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .result-summary {
    margin-bottom: 20px;
    
    h4 {
      margin-bottom: 10px;
      color: #303133;
      font-size: 14px;
      font-weight: 600;
    }
    
    .stats-list {
      max-height: 150px;
      overflow-y: auto;
      
      .stats-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 5px 0;
        border-bottom: 1px solid #f0f0f0;
        font-size: 13px;
        
        &:last-child {
          border-bottom: none;
        }
        
        span:first-child {
          color: #606266;
        }
      }
    }
  }

  .results-table {
    .context-text {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-size: 12px;
      color: #606266;
      line-height: 1.4;
    }

    .table-actions {
      display: flex;
      gap: 8px;
      align-items: center;
      flex-wrap: nowrap;
      
      .el-button {
        margin: 0;
        font-size: 12px;
        padding: 4px 8px;
        white-space: nowrap;
      }
    }
  }

  .pagination {
    margin-top: 20px;
    text-align: center;
  }
}

// 对话框样式
.keyword-dialog {
  .dialog-form {
    .el-form-item {
      margin-bottom: 20px;
    }
    
    .el-textarea {
      :deep(.el-textarea__inner) {
        min-height: 80px;
      }
    }
  }
}

.detail-dialog {
  .record-details {
    .el-descriptions {
      margin-bottom: 20px;
    }
    
    h4 {
      margin: 20px 0 10px 0;
      color: #303133;
      font-size: 14px;
      font-weight: 600;
    }
    
    .record-actions {
      text-align: center;
      margin-top: 20px;
    }
  }
}

.sql-dialog {
  .sql-content {
    .action-selection {
      margin-bottom: 15px;
    }
    
    h4 {
      margin: 15px 0 10px 0;
      color: #303133;
      font-size: 14px;
      font-weight: 600;
    }
    
    .warning-alert {
      margin: 15px 0;
    }
  }
}

// 响应式设计
@media (max-width: 1200px) {
  .keyword-list {
    max-height: 200px;
  }
  
  .stats-list {
    max-height: 100px;
  }
  
  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

@media (max-width: 768px) {
  .keyword-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    
    .keyword-actions {
      align-self: flex-end;
    }
  }
  
  .batch-actions {
    flex-direction: column;
  }
  
  .progress-stats {
    flex-direction: column;
    gap: 4px;
  }
}

// 主题适配  
@media (prefers-color-scheme: dark) {
  .progress-section {
    background: #2a2a2a;
    border-color: #3a3a3a;
  }
  
  .keyword-item {
    border-bottom-color: #3a3a3a;
  }
  
  .stats-item {
    border-bottom-color: #3a3a3a;
  }
}

// 表选择相关样式
.table-selection-section {
  margin: 16px 0;

  .collapse-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
  }
}

// Transfer组件样式
.table-transfer-container {
  .transfer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 14px;
    color: #333;

    .transfer-info {
      display: flex;
      align-items: center;
      gap: 8px;
    }
  }

  // 自定义Transfer组件样式
  :deep(.el-transfer) {
    .el-transfer-panel {
      width: 300px;
      height: 400px;
      border-radius: 8px;
      border: 1px solid #e1e8ed;

      .el-transfer-panel__header {
        background-color: #f8f9fa;
        border-bottom: 1px solid #e1e8ed;
        padding: 12px 16px;
        font-weight: 500;
      }

      .el-transfer-panel__body {
        padding: 0;

        .el-transfer-panel__list {
          height: 320px;
          padding: 8px;
        }

        .el-transfer-panel__item {
          padding: 8px 12px;
          margin-bottom: 4px;
          border-radius: 6px;
          transition: all 0.2s ease;
          min-height: 52px;
          display: flex;
          align-items: center;

          &:hover {
            background-color: #f5f7fa;
          }

          &.is-checked {
            background-color: #e6f4ff;
            border-color: #409eff;
          }

          // 优化勾选框样式 - 与图标对齐
          :deep(.el-checkbox) {
            width: 100%;
            margin: 0;
            display: flex;
            align-items: flex-start;
            
            .el-checkbox__input {
              margin-right: 10px;
              margin-top: 2px; // 与图标顶部对齐
              margin-bottom: 0;
              flex-shrink: 0;
            }
            
            .el-checkbox__label {
              flex: 1;
              padding: 0;
              margin: 0;
              display: block;
              cursor: pointer;
              line-height: normal;
            }
          }
        }
      }

      .el-transfer-panel__filter {
        padding: 12px;
        border-bottom: 1px solid #e1e8ed;

        .el-input__wrapper {
          border-radius: 6px;
        }
      }
    }

    .el-transfer__buttons {
      padding: 0 20px;

      .el-button {
        padding: 8px 16px;
        border-radius: 6px;
        font-size: 13px;
      }
    }
  }

  // 自定义Transfer项目样式
  .transfer-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    min-height: 36px;

    .table-icon {
      flex-shrink: 0;
      font-size: 16px;
      color: #409eff;
      margin-top: 2px; // 与勾选框对齐
    }

    .table-content {
      flex: 1;
      min-width: 0; // 防止内容溢出
      display: flex;
      flex-direction: column;
      justify-content: flex-start;
      padding-top: 1px; // 微调文本位置

      .table-name {
        font-weight: 500;
        color: #333;
        font-size: 14px;
        line-height: 1.3;
        margin-bottom: 2px;
        word-break: break-all;
      }

      .table-comment {
        font-size: 12px;
        color: #666;
        line-height: 1.2;
        word-break: break-all;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin: 0;
      }
    }
  }
}

// 响应式适配
@media (max-width: 768px) {
  .table-transfer-container {
    .transfer-header {
      flex-direction: column;
      align-items: flex-start;
      gap: 8px;
    }

    :deep(.el-transfer) {
      .el-transfer-panel {
        width: 280px;
        height: 350px;

        .el-transfer-panel__body .el-transfer-panel__list {
          height: 270px;
        }

        .el-transfer-panel__item {
          min-height: 48px;
          padding: 6px 10px;
          
          :deep(.el-checkbox) {
            .el-checkbox__input {
              margin-right: 8px;
              margin-top: 2px;
            }
          }
        }
      }

      .el-transfer__buttons {
        padding: 0 10px;
      }
    }
  }
}

// 暗色主题适配
@media (prefers-color-scheme: dark) {
  .table-transfer-container {
    .transfer-header {
      color: #fff;
    }

    :deep(.el-transfer) {
      .el-transfer-panel {
        background-color: #2a2a2a;
        border-color: #3a3a3a;

        .el-transfer-panel__header {
          background-color: #1f1f1f;
          border-color: #3a3a3a;
          color: #fff;
        }

        .el-transfer-panel__item {
          &:hover {
            background-color: #333;
          }

          &.is-checked {
            background-color: #1a3a5c;
          }
        }
      }
    }

    .transfer-item {
      .table-icon {
        color: #79bbff;
      }

      .table-content {
        .table-name {
          color: #fff;
        }

        .table-comment {
          color: #ccc;
        }
      }
    }
  }
}

// 历史任务样式
.history-tasks {
  .task-loading, .no-tasks {
    text-align: center;
    padding: 20px;
    color: #909399;
    font-size: 13px;
  }

  .task-list {
    max-height: 300px;
    overflow-y: auto;
  }

  .task-item {
    padding: 12px;
    border: 1px solid #f0f0f0;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;

    &:hover {
      border-color: #409eff;
      box-shadow: 0 2px 8px rgba(64, 158, 255, 0.1);
    }

    &.active {
      border-color: #409eff;
      background: #f0f8ff;
    }

    &:last-child {
      margin-bottom: 0;
    }
  }

  .task-info {
    .task-name {
      font-size: 13px;
      font-weight: 500;
      color: #303133;
      margin-bottom: 6px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .task-meta {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 4px;

      .task-time {
        font-size: 11px;
        color: #909399;
      }
    }

    .task-stats {
      display: flex;
      justify-content: space-between;
      font-size: 11px;
      color: #606266;

      span {
        background: #f5f7fa;
        padding: 2px 6px;
        border-radius: 3px;
      }
    }
  }
}

// ============ 暗黑模式适配 ============
:global(.dark) {
  // 卡片标题
  .keyword-card .card-header .card-title,
  .check-card .card-header .card-title,
  .results-card .card-header .card-title {
    color: #e5eaf3;
  }

  // 敏感词列表
  .keyword-management {
    .keyword-list {
      .keyword-item {
        border-bottom-color: #303030;

        .keyword-text {
          color: #e5eaf3;
        }
      }
    }

    .batch-actions {
      border-top-color: #303030;
    }
  }

  // 系统状态
  .status-info {
    .status-item {
      border-bottom-color: #303030;

      .status-label {
        color: #b3b3b3;
      }

      .status-value {
        color: #e5eaf3;
      }
    }
  }

  // 检测区域
  .check-content .input-textarea {
    background-color: #252525;
    border-color: #3f3f3f;
    color: #e5eaf3;

    &:focus {
      border-color: #42d392;
      box-shadow: 0 0 0 3px rgba(66, 211, 146, 0.15);
    }

    &::placeholder {
      color: #666;
    }
  }

  // 检测结果
  .results-content {
    .result-summary {
      background-color: #252525;
      border-color: #303030;
      color: #e5eaf3;
    }

    .hit-items .hit-item {
      background-color: #252525;
      border-color: #303030;

      &:hover {
        border-color: #42d392;
        box-shadow: 0 2px 8px rgba(66, 211, 146, 0.15);
      }

      .hit-word {
        color: #ff7875;
      }

      .hit-category {
        color: #b3b3b3;
      }

      .hit-positions {
        color: #909399;
      }
    }
  }

  // 历史任务
  .history-sidebar {
    background-color: #1e1e1e;
    border-right-color: #303030;

    .sidebar-header {
      border-bottom-color: #303030;

      .sidebar-title {
        color: #e5eaf3;
      }
    }

    .task-item {
      background: #252525;
      border-color: #303030;

      &:hover {
        border-color: #42d392;
        box-shadow: 0 2px 8px rgba(66, 211, 146, 0.15);
      }

      &.active {
        border-color: #42d392;
        background: #1a4d3d;
      }
    }

    .task-info {
      .task-name {
        color: #e5eaf3;
      }

      .task-meta .task-time {
        color: #909399;
      }

      .task-stats {
        color: #b3b3b3;

        span {
          background: #1a1a1a;
        }
      }
    }
  }
}